package com.example.streamconsumer.controller;

import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @author zhaoren
 * @version 1.0
 * @description 接收消息
 * @date 2020/9/2 15:06
 **/
@Component
@EnableBinding(Sink.class)
public class MessageController {

    @StreamListener(Sink.INPUT)
    public void input(Message message) {
        System.out.println("消费者1号，接受："+message.getPayload());
    }

}
